// 获取DOM元素
const fileInput = document.getElementById("fileInput");
const confirmBtn = document.getElementById("confirmBtn");
const createBtn = document.getElementById("createBtn");
const uploadButton = document.getElementById("uploadButton");
const uploadBtnImg = document.querySelector(".upload-btn-img");
const uploadedImageContainer = document.getElementById(
  "uploadedImageContainer"
);
const uploadedImage = document.getElementById("uploadedImage");
const backBtn = document.querySelector(".back-btn"); // 返回按钮
// 获取所有地图按钮
const mapButtons = document.querySelectorAll(".map-btn");

// 为每个按钮添加点击事件
mapButtons.forEach((btn) => {
  btn.addEventListener("click", function () {
    // 根据按钮 ID 决定跳转路径
    switch (this.id) {
      case "btn-jiucengta":
        window.location.href = "../html/起点.html";
        break;
      case "btn-jiuselu":
        window.location.href = "../html/视觉碎片1.html";
        break;
      case "btn-mingshashan":
        window.location.href = "../html/视觉碎片2.html";
        break;
      case "btn-yueyaquan":
        window.location.href = "../html/视觉碎片3.html";
        break;
      case "btn-tuoling":
        window.location.href = "../html/听觉碎片.html";
        break;
      case "btn-shujuan":
        window.location.href = "../html/文字碎片.html";
        break;
      default:
        // 默认跳转（可替换为首页或其他页面）
        window.location.href = "../html/标志地图1.html";
    }
  });
});

// 返回按钮功能：点击返回上一页
backBtn.addEventListener("click", () => {
  window.history.back();
});

//创建按钮点击事件（跳转页面）
const directCreateBtn = document.getElementById("directCreateBtn");
if (directCreateBtn) {
  directCreateBtn.addEventListener("click", () => {
    // 替换为目标跳转页面的URL
    window.location.href = "../html/记忆.html";
  });
}
